using System;
using System.Collections.Generic;
using System.Text;
using Shc.Sql;
using Shc.Json;
namespace Slqj.Data
{
	public static class TableAuthAdminRole
	{
		public const string Table = "AuthAdminRole";
		public const string AdminRoleID = "AdminRoleID";
		public const string AdministratorID = "AdministratorID";
		public const string RoleIDList = "RoleIDList";
	}
	
	[Serializable]
	public class BaseAuthAdminRole
		: IDbSessionEntity, IJsonClass
	{
		int m_AdminRoleID;
		/// <summary>
        /// 管理员角色关系表ID(主键)
        /// </summary>
        public int AdminRoleID
        {
            get { return m_AdminRoleID; }
            set { m_AdminRoleID = value; }
        }
		
		int m_AdministratorID;
		/// <summary>
        /// 用户帐号表ID
        /// </summary>
        public int AdministratorID
        {
            get { return m_AdministratorID; }
            set { m_AdministratorID = value; }
        }
		
		string m_RoleIDList;
		/// <summary>
        /// 角色ID列表
        /// </summary>
        public string RoleIDList
        {
            get { return m_RoleIDList; }
            set { m_RoleIDList = value; }
        }
		
		
		#region IDbSessionEntity Members
		public void ReadDBData(RowDataReader reader)
        {
            m_AdminRoleID = reader[TableAuthAdminRole.AdminRoleID];
            m_AdministratorID = reader[TableAuthAdminRole.AdministratorID];
            m_RoleIDList = reader[TableAuthAdminRole.RoleIDList];
        }
		
		public void WriteDBData(RowDataWriter writer)
        {
            writer.SetPrimaryKey(TableAuthAdminRole.AdminRoleID, PrimaryKeyType.Identity, AdminRoleID);
			writer[TableAuthAdminRole.AdministratorID] = AdministratorID;
			writer[TableAuthAdminRole.RoleIDList] = RoleIDList;
        }

        public void SetIdentityAfterInsert(DBObject idd)
        {
            m_AdminRoleID = idd;
        }
		
		public string TableName
        {
            get { return TableAuthAdminRole.Table; }
        }
		#endregion
		
		#region IJsonClass Members

        public void JsonDeSerializeObj(JsonHashTable hashToRead)
        {
             m_AdminRoleID = hashToRead["AdminRoleID"];
			 
             m_AdministratorID = hashToRead["AdministratorID"];
			 
             m_RoleIDList = hashToRead["RoleIDList"];
			 
        }

        public void JsonSerializeObj(JsonHashTable hashToFill)
        {
            hashToFill["AdminRoleID"] = AdminRoleID;
			 
            hashToFill["AdministratorID"] = AdministratorID;
			 
            hashToFill["RoleIDList"] = RoleIDList;
			 
        }

        #endregion
		
	}
}
